package cn.edu.lzu.dao;

import cn.edu.lzu.entity.FillMedItem;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * @PackageName: cn.edu.lzu.dao
 * @InterfaceName: FillMedItemMapper
 * @Description: TODO
 * @Author: 张琦[QQ:3098086691]
 * @Date: 2020/4/10 17:13
 * @Version: 1.0
 */
@Mapper
public interface FillMedItemMapper {
    @Select("select * from fill_med_item where is_deleted=0 and book_registe_id=#{bookRegisteId} and examine_item_id=#{examineItemId}")
    FillMedItem selRecordByBookIdAndItemId(int bookRegisteId, int examineItemId);

    @Insert("insert into fill_med_item (fill_med_item_id, book_registe_id, examine_item_id, is_deleted, is_filled) values (default, #{bookRegisteId}, #{examineItemId}, 0, 0)")
    int insFillMedItem(int bookRegisteId, int examineItemId);

    @Update("update fill_med_item set examiner_id=#{examinerId}, diagnosis=#{diagnosis}, examine_time=#{examineTime}, is_filled=1 where fill_med_item_id=#{fillMedItemId}")
    int updMedItemStatusFilled(FillMedItem fillMedItem);
}
